﻿using System;
using Transformable_Engine_v2.Engine.Graphics;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Super_Management_Mayhem.Content.Spritesheet
{
    public class ItemSheet : SpriteSheetInstance
    {
        private static SpriteSheetInstance _instance;
        public static void LoadContent()
        {
            _instance = new ItemSheet();
        }
        public new static Sprite GetSprite(Enum textureName)
        {
            return _instance.GetSprite(textureName);
        }

        public enum Tile
        {
            Button,
            ButtonPressed,
            ItemTile,
            Torch
        }

        public enum Switch
        {
            Off,
            Toggle0,
            Toggle1,
            Toggle2,
            On,
        }

        public enum Item 
        {
            Bomb,
            Shuriken,
            Random,
            Crate,
        }

        public enum ItemOutline
        {
            BombOutline,
            ShurikenOutline,
            RandomOutline,
        }

        public enum WarpTarget
        {
            Target0,
            Target1,
        }

        public enum Warp
        {
            Warp0,
            Warp1,
            Warp2,
        }

        public enum PlayerWarp
        {
            Warp0,
            Warp1,
            Warp2,
            Warp3,
            Warp4,
            Warp5,
            Warp6,
            Warp7,
            Warp8,
            Warp9,
            Warp10,
            Warp11,
            Warp12,
            Warp13,
            Warp14
        }

        public enum WarpStar
        {
            Star0,
            Star1,
            Star2,
            Star3,
            Star4,
        }

        public enum BombAnimation
        {
            LongFuse0,
            LongFuse1,
            LongFuse2,
            MediumFuse0,
            MediumFuse1,
            MediumFuse2,
            ShortFuse0,
            ShortFuse1,
            ShortFuse2,
        }

        public enum RandomObjectItems
        {
            Range,
            Points,
            Power,
            Magic,
            Damage,
            Utility,
            Random,
            Count,
        }

        public enum Classes
        {
            Pedestral,
            Power,
            Range,
            Damage,
            Magic,
            Utility,
            Random,
            Unknown,
        }


        public override string SpriteSheetPath
        {
            get
            {
                return "Content/Images/Items.png";
            }
        }

        protected override void LoadSprites()
        {
            AddSprite(Tile.Button, new TE_Rectangle(4, 0, 1, 1));
            AddSprite(Tile.ButtonPressed, new TE_Rectangle(5, 0, 1, 1));
            AddSprite(Tile.ItemTile, new TE_Rectangle(6, 0, 1, 1));
            AddSprite(Tile.Torch, new TE_Rectangle(10, 1, 1, 1));

            AddSprite(Item.Bomb, new TE_Rectangle(0, 0, 1, 1));
            AddSprite(Item.Crate, new TE_Rectangle(7, 0, 1, 1));
            AddSprite(Item.Random, new TE_Rectangle(4, 1, 1, 1));
            AddSprite(Item.Shuriken, new TE_Rectangle(5, 1, 1, 1));

            AddSprite(BombAnimation.LongFuse0, new TE_Rectangle(1, 0, 1, 1));
            AddSprite(BombAnimation.LongFuse1, new TE_Rectangle(2, 0, 1, 1));
            AddSprite(BombAnimation.LongFuse2, new TE_Rectangle(3, 0, 1, 1));
            AddSprite(BombAnimation.MediumFuse0, new TE_Rectangle(1, 1, 1, 1));
            AddSprite(BombAnimation.MediumFuse1, new TE_Rectangle(2, 1, 1, 1));
            AddSprite(BombAnimation.MediumFuse2, new TE_Rectangle(3, 1, 1, 1));
            AddSprite(BombAnimation.ShortFuse0, new TE_Rectangle(1, 2, 1, 1));
            AddSprite(BombAnimation.ShortFuse1, new TE_Rectangle(2, 2, 1, 1));
            AddSprite(BombAnimation.ShortFuse2, new TE_Rectangle(3, 2, 1, 1));

            AddSprite(Switch.Off, new TE_Rectangle(4, 2, 1, 1));
            AddSprite(Switch.Toggle0, new TE_Rectangle(5, 2, 1, 1));
            AddSprite(Switch.Toggle1, new TE_Rectangle(6, 2, 1, 1));
            AddSprite(Switch.Toggle2, new TE_Rectangle(7, 2, 1, 1));
            AddSprite(Switch.On, new TE_Rectangle(8, 2, 1, 1));

            AddSprite(WarpTarget.Target0, new TE_Rectangle(6, 1, 1, 1));
            AddSprite(WarpTarget.Target1, new TE_Rectangle(7, 1, 1, 1));

            AddSprite(Warp.Warp0, new TE_Rectangle(0, 3, 1, 1));
            AddSprite(Warp.Warp1, new TE_Rectangle(1, 3, 1, 1));
            AddSprite(Warp.Warp2, new TE_Rectangle(2, 3, 1, 1));

            AddSprite(WarpStar.Star0, new TE_Rectangle(8, 0, 0.5f, 0.5f));
            AddSprite(WarpStar.Star1, new TE_Rectangle(8.5f, 0, 0.5f, 0.5f));
            AddSprite(WarpStar.Star2, new TE_Rectangle(9, 0, 0.5f, 0.5f));
            AddSprite(WarpStar.Star3, new TE_Rectangle(9.5f, 0, 0.5f, 0.5f));
            AddSprite(WarpStar.Star4, new TE_Rectangle(10, 0, 0.5f, 0.5f));

            AddSprite(ItemOutline.BombOutline, new TE_Rectangle(7, 3, 1, 1));
            AddSprite(ItemOutline.RandomOutline, new TE_Rectangle(8, 3, 1, 1));
            AddSprite(ItemOutline.ShurikenOutline, new TE_Rectangle(9, 3, 1, 1));

            AddEnumList<PlayerWarp>(PlayerWarp.Warp0, PlayerWarp.Warp6, new TE_Rectangle(0, 4, 2, 2));
            AddEnumList<PlayerWarp>(PlayerWarp.Warp7, PlayerWarp.Warp13, new TE_Rectangle(0, 6, 2, 2));
            AddSprite(PlayerWarp.Warp14, new TE_Rectangle(0, 0, 0, 0));

            AddEnumList<RandomObjectItems>(RandomObjectItems.Range, RandomObjectItems.Random, new TE_Rectangle(11, 0, 1, 1), 3);

            AddEnumList<Classes>(Classes.Pedestral, Classes.Unknown, new TE_Rectangle(0, 8, 1, 1));
        }
    }
}